package net.cityside.summer.web.security;

import net.cityside.summer.domain.Authority;

import org.springframework.security.core.GrantedAuthority;

/**
 * 这个类中的成员必须都是可序列化的
 * 
 * @author YaoYuan
 * 
 */
public class SecuredAuthority implements GrantedAuthority {

	private static final long serialVersionUID = 1L;

	private final Authority authority;

	public SecuredAuthority(Authority authority) {
		if (authority == null) {
			throw new IllegalArgumentException("authority cannot be null");
		}
		this.authority = authority;
	}

	@Override
	public String getAuthority() {
		return authority.getName();
	}

}
